package com.demo.mapper;

import com.ayou.annotations.*;
import com.demo.entity.User;

import java.util.List;

/**
 * @description:
 * @author: ayouman
 * @date: 2024/5/9 23:30
 */
public interface UserMapper {
    @Select("select * from t_user")
    List<User> selectList();

    @Select("select * from t_user where name = #{name}")
    User selectOne();

    @Update("update t_user set name = #{user.name}, age = #{user.age} where id = #{user.id}")
    int update(@Param("user") User user);

    @Delete("delete from t_user where id=#{id}")
    int delete(@Param("id") int id);

    @Insert("insert into t_user(name, age) values(#{user.name}, #{user.age})")
    int insert(@Param("user") User user);

}
